/**

* <p>Title: OrdersItemsServiceImpl.java</p>

* <p>Description: </p>

* <p>Copyright: Copyright (c) 2021</p>

* <p>Company: www.chinasofti.com</p>

* @author knowno

* @date 2021年3月11日

* @version 1.0

*/
package com.etc.zmall.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.etc.dao.ItemsMapper;
import com.etc.entity.Items;
import com.etc.entity.ItemsExample;
import com.etc.zmall.service.OrdersItemsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

/**
 * 
 * <p>
 * Title: OrdersItemsServiceImpl
 * </p>
 * 
 * <p>
 * Description:
 * </p>
 * 
 * @author knowno
 * 
 * @date 2021年3月11日
 * 
 */
@Service
public class OrdersItemsServiceImpl implements OrdersItemsService {

	@Autowired
	private ItemsMapper itemsMapper;

	/**
	 * (non-Javadoc)
	 * 
	 * <p>
	 * Title: getByPage
	 * </p>
	 * 
	 * <p>
	 * Description:
	 * </p>
	 * 
	 * @param orderid
	 * @param page
	 * @param limit
	 * @return
	 * 
	 * @see com.etc.zmall.service.OrdersItemsService#getByPage(java.lang.String,
	 *      int, int)
	 * 
	 */
	@Override
	public PageInfo<Items> getByPage(String orderid, int page, int limit) {
		// TODO Auto-generated method stub
		ItemsExample example = new ItemsExample();
		// 传递参数为orderid
		example.createCriteria().andOrderidEqualTo(orderid);
		// 加入分页有关的代码
		PageHelper.startPage(page, limit);

		List<Items> list = itemsMapper.selectByExample(example);

		// pageInfo对象
		PageInfo<Items> pageinfo = new PageInfo<Items>(list);

		return pageinfo;
	}

	/**
	 * (non-Javadoc)
	 * 
	 * <p>
	 * Title: getByPageMulti
	 * </p>
	 * 
	 * <p>
	 * Description:
	 * </p>
	 * 
	 * @param orderid
	 * @param page
	 * @param limit
	 * @return
	 * 
	 * @see com.etc.zmall.service.OrdersItemsService#getByPageMulti(java.lang.String,
	 *      int, int)
	 * 
	 */
	@Override
	public PageInfo<Items> getByPageMulti(String orderid, int page, int limit) {
		// TODO Auto-generated method stub

		ItemsExample example = new ItemsExample();
		example.setOrderid(orderid);
		// 根据goodsname进行查询
		example.createCriteria();
		PageHelper.startPage(page, limit);
		List<Items> list = itemsMapper.selectByOrderId(example);

		// pageInfo对象
		PageInfo<Items> pageinfo = new PageInfo<Items>(list);
		return pageinfo;
	}

}
